
package com.our.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;


public class MyExceptionHandle {
	@ExceptionHandler
	public ModelAndView doException(Exception ex){
		ex.printStackTrace();
		ModelAndView mv = new ModelAndView("/error");
		String code = ex.getMessage();
		mv.addObject("code", code);
		return mv;
	}
}




